Beaker = Widget.extend({
	runningAction:null,
	ctor:function(){
		this._super();
		this.init();
		this.setTag(TAG_BEAKER_ALL);
	},
	init:function(){
		this.body = new Button(this, 10, TAG_BEAKER, "#beaker.png", this.callback,this);
		
		var line=new Button(this.body,10,TAG_BEAKER_LINE,"#beaker_line.png",this.callback,this);
		line.setPosition(cc.p(this.body.width*0.5, this.body.height*0.1));
		line.setOpacity(0);
	},
	showLine:function(){
		var line=this.body.getChildByTag(TAG_BEAKER_LINE);
		var fadein=cc.fadeIn(0.5)
		var move=cc.moveBy(1,cc.p(0, this.body.height*0.2))
		line.runAction(cc.sequence(fadein,move));
	},
	showLine1:function(){
		var line=this.body.getChildByTag(TAG_BEAKER_LINE);
		var move=cc.moveBy(1,cc.p(0, this.body.height*0.2));
		line.runAction(move);
	},
	shaking:function(){
		var rotate=cc.rotateBy(0.2,15);
		var rotate1=cc.rotateBy(0.2,-15);
		this.body.runAction(cc.sequence(rotate,rotate.reverse(),rotate1,rotate1.reverse()).repeat(3));
	},
	downLine:function(){
		var line=this.body.getChildByTag(TAG_BEAKER_LINE);
		var move=cc.moveBy(3.5,cc.p(0, -this.body.height*0.2));
		line.runAction(move);
	},
	callback:function(p){
		var func=cc.callFunc(function() {
			gg.flow.next();
		}, this);
		switch (p.getTag()) {
		case TAG_BEAKER:
			p.runAction(cc.sequence(cc.callFunc(function() {
				this.shaking();
			},this),func));
			break;
		default:
			break;
		}
	}
	
});